package com.dropesoft.ui;

import com.dropesoft.biz.DashboardAdapter;
import com.dropesoft.entities.DashboardEntry;

import dropesoft.com.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

public class MainActivity extends Activity implements OnItemClickListener {

  private DashboardEntry[] dashboardEntries = {
      new DashboardEntry(R.string.menu_allenamenti,
          android.R.drawable.ic_menu_sort_by_size,
          ListaAllenamenti.class),
      new DashboardEntry(R.string.menu_agenda,
          android.R.drawable.ic_menu_edit, ListaAllenamenti.class),
       };

  private GridView dashboardGridView;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    dashboardGridView = (GridView) findViewById(R.id.dashboardGridView);
    dashboardGridView.setOnItemClickListener(this);
    dashboardGridView.setAdapter(new DashboardAdapter(MainActivity.this,
        R.layout.dashboard_entry, dashboardEntries));

  }
/*
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position,
      long id) {
    
  }*/

public void onItemClick(AdapterView<?> parent, View view, int position,
	      long id) {
	startActivity(new Intent(this, dashboardEntries[position].getActivity()));
	
}

}